//
//  SpaceHeader.swift
//  ZYA
//
//  Created by 邱仙凯 on 2024/12/3.
//  Copyright © 2024 zwb. All rights reserved.
//

import UIKit
class SpaceHeader: UICollectionReusableView {
    
    var titleLabel: UILabel!
    var img: UIImageView = {
        let img = UIImageView()
        return img
    }()
    var bg:UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 8
        v.layer.masksToBounds = true
        return v
    }()
    var jianbianBg:GradientView = {
        let v = GradientView()
        return v
    }()
    var tipIcon:UIButton = {
        var v = UIButton()
        v.isHidden = true
        v.setBackgroundImage(UIImage(named: "tip_icon"), for: .normal)
        return v
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = .clear
        self.layer.masksToBounds = true
        addSubview(bg)
        bg.addSubview(jianbianBg)
        jianbianBg.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
     
        bg.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(newModuleLeading)
            make.right.equalToSuperview().offset(-newModuleLeading)
            make.top.equalToSuperview()
            make.bottom.equalToSuperview().offset(8)
        }
        
        
        
        titleLabel = UILabel()
        titleLabel.font = UIFont.boldSystemFont(ofSize: 20)
        titleLabel.textColor = UIColor(kshex:"#222222")
        bg.addSubview(titleLabel)
        bg.addSubview(img)
        img.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(10)
            make.centerY.equalTo(self)
            make.width.height.equalTo(27)
        }
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(img.snp.right).offset(10)
            make.centerY.equalTo(self)
        }
        bg.addSubview(tipIcon)
        tipIcon.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-10)
            make.width.height.equalTo(25)
        }
         
        
    }
 
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
